package com.green.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * Controller实例
 */
@Controller
@RequestMapping("/test1")
public class TestController {


    /**
     * 没加ResponseBody，默认返回的是视图，需要再resource/templates中定义
     * ResponseBody注解将数据放在响应体中返回
     * @return
     */
    @RequestMapping("hello")
    @ResponseBody
    public String test(){
        System.out.println("1111方法执行了");
        return "hello world";
    }
}
